package com.ruiysoft.website.controller;

import com.ruiysoft.website.dto.ResponseEx;
import com.ruiysoft.website.service.CmsContentService;
import com.ruiysoft.website.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by liudh on 2019/4/25.
 */

@RestController
@RequestMapping("user")
public class SysUserController {
    @Autowired
    SysUserService sysUserService;

//    @Cacheable(value="login")
    @GetMapping("login")
    public Object login(String un, String pw) {
        ResponseEx responseEx = new ResponseEx();
        responseEx.setSuccess(false);

        Object obj = sysUserService.login(un, pw);
        if(obj != null) {
            responseEx.setSuccess(true);
            responseEx.setData(obj);
        }

        return responseEx;
    }

}

